<?php include APP_ADMIN_VIEW . 'include/head.php';?>
<div class="panel panel-default">
                            <div class="panel-heading">页面列表</div>
                            <div class="panel-body">
  <form accept="/<?php echo APP_ADMIN_URI; ?>/page/list" method="GET">
    <div class="input-group input-group-lg" style="width: 40%;margin-bottom: 10px;">
      <input type="text" name="k"  class="form-control" placeholder="Search for..." value="<?php echo $keyword; ?>"/>
      <span class="input-group-btn">
          <button style="z-index:2" class="btn btn-primary md-search-white" type="submit">&nbsp;&nbsp;&nbsp;&nbsp;</button>
      </span>
    </div>
  </form>
<!-- Table goes in the document BODY -->
<table class="table table-bordered table-hover">
<tr>
    <th>编号</th><th>标题</th><th>菜单</th><th>阅读数</th><th>评论数</th><th>草稿</th><th>更新</th><th>状态</th><th>编辑</th>
</tr>
<?php if ($page_array): ?>
<?php foreach ($page_array as $page_data): ?>
<tr>
    <td width="5%"><?php echo $page_data['id']; ?></td>
    <td width="20%">
        <a href="<?php echo isset($page_data['url']) ? $page_data['url'] : ''; ?>" target="_blank">
        <?php echo isset($page_data['title']) ? $page_data['title'] : ''; ?>
        </a>

        </td>
    <td width="10%">
      <a href="/<?php echo APP_ADMIN_URI; ?>/page/list?mid=<?php echo isset($page_data['menu_id']) ? $page_data['menu_id'] : '0'; ?>">
        <?php echo isset($page_data['menu_name']) ? $page_data['menu_name'] : ''; ?>
      </a>
        </td>
    <td width="5%"><?php echo isset($page_data['page_view_count']) ? $page_data['page_view_count'] : ''; ?></td>
    <td width="5%"><?php echo isset($page_data['comment_count']) ? $page_data['comment_count'] : ''; ?></td>
    <td width="5%"><?php echo isset($page_data['draft']) ? $page_data['draft'] : ''; ?></td>
    <td width="5%"><?php echo isset($page_data['is_build']) ? $page_data['is_build'] : ''; ?></td>
    <td width="5%"><?php echo isset($page_data['status']) ? $page_data['status'] : ''; ?></td>
    <td width="10%">
        <a href="/<?php echo APP_ADMIN_URI; ?>/page/create?hash=<?php echo isset($page_data['hash']) ? $page_data['hash'] : ''; ?>">编辑</a>&nbsp;|&nbsp;
        <a href="javascript:deletePage('<?php echo isset($page_data['hash']) ? $page_data['hash'] : ''; ?>')">删除</a>
        <a href="javascript:buildPage('<?php echo isset($page_data['hash']) ? $page_data['hash'] : ''; ?>')">更新</a>
        <a href="/<?php echo APP_ADMIN_URI; ?>/page/preview?hash=<?php echo isset($page_data['hash']) ? $page_data['hash'] : ''; ?>" target='_blank'>预览</a>
        </td>
</tr>
<?php endforeach?>
<?php else: ?>
<tr>
    <td colspan="9">暂无数据</td>
</tr>
<?php endif?>
</table>
        <div class="pagination">
<ul>
<?php echo $page_navigation; ?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
    function deletePost(hash)
    {
        var msg = "您真的确定要删除吗？";
        if (confirm(msg)==true){
          htmlobj=$.ajax({url:"/admin/page/delete?hash="+hash,async:false});
          if (htmlobj.responseText=="1") {
               //$("#tr"+num).hide();
               alert('删除成功');
               location.reload();
          }
        }

    }
    function buildPage(hash)
    {
          htmlobj=$.ajax({url:"/admin/build/page?hash="+hash,async:false});
          if (htmlobj.responseText=="1") {
               location.reload();
          }
    }
</script>
<?php include APP_ADMIN_VIEW . 'include/foot.php';?>